tools/libxl: fix memory management bugs in libxl_device_disk_list()
authorGianni Tedesco <gianni.tedesco@citrix.com>
Mon, 16 Aug 2010 12:37:58 +0000 (13:37 +0100)
committerGianni Tedesco <gianni.tedesco@citrix.com>
Mon, 16 Aug 2010 12:37:58 +0000 (13:37 +0100)
commit2385a2339abfca211af3267a63e12167310b4377
tree39df89eb9489adcbdcfd318df692a38e0948c306
parentaa70182b712c64769dfa1d4304f53c0deedf0a9b
tools/libxl: fix memory management bugs in libxl_device_disk_list()

fix invalid free segfault and use-after-free in libxl_device_disk_list()

Gah, libxl_device_disk_list() is returning a lot of pointers to free'd
data. Fix that by replacing libxl_xs_read() with xs_read() in line with
the policy.

Also fix a segfault caused by an erroneous free of the last disk-list
array element rather than the first one. This was causing xl create to
segfault when using the new qemu-dm code-base. Fix that and add a
comment about the fact that this libxl API requires a corresponding
libxl_device_disk_free() function.

Signed-off-by: Gianni Tedesco <gianni.tedesco@citrix.com>
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
tools/libxl/libxl.c